# Histogram / boxplot in margin
library(ggplot2)
library(ggExtra)

data(mpg, package = "ggplot2")

theme_set(theme_bw())

mpg_select <- mpg[mpg$hwy >= 35 & mpg$cty > 27, ]

g <- ggplot(mpg, aes(cty, hwy)) +
    geom_count() +
    geom_smooth(method = "lm", se = F)

ggMarginal(g, tyep = "histogram", fill = "transparent")
ggMarginal(g, type = "boxplot", fill = "transparent")
ggMarginal(g, type = "density", fill = "transparent")
